package main

import (
	"go.uber.org/fx"
	"mallgo/config"
	"mallgo/core"
	"mallgo/internal/controller/app"
	"mallgo/internal/controller/order"
	"mallgo/internal/controller/product"
	"mallgo/internal/controller/sql"
	"mallgo/internal/controller/user"
	"mallgo/internal/controller/web"
	"mallgo/internal/database"
)

func main() {
	app := fx.New(
		// 加载配置
		fx.Provide(config.LoadLocal),
		// 初始化数据库
		fx.Provide(database.InitGorm),

		fx.Provide(core.NewServer),

		// 初始化模块
		product.Module,
		user.Module,
		order.Module,
		web.Module,
		app.Module,
		sql.Module,
		fx.Invoke(core.Run),
	)

	app.Run()
}
